{{#if @schemas.length}}
  <div class="row dataset-schema__header">
    <div class="col-xs-12">
      <div class="btn-group">
        <Placeholder::NachoToggle
          aria-label="Toggle Table / JSON Schema View"
          @value={{this.isShowingTable}}
          @leftOptionValue={{true}}
          @leftOptionText="Table"
          @rightOptionValue={{false}}
          @rightOptionText="JSON"
          @onChange={{fn this.onToggleSchemaViewTypeTask}}
        />
      </div>
      <div
        class="schemas-modified-time"
        aria-label="Last time the Dataset Schema was modified"
      >
        Last modified: {{@lastModified}}
      </div>
    </div>
  </div>

  {{#if this.isShowingTable}}
    <NachoTable @tableClass="nacho-table nacho-table--dynamic nacho-table--striped dataset-detail-table" as |Table|>
      <Table.head @class="results-header" as |Head|>
        <Head.title @class="dataset-detail-table__th-field-name col-xs-2">
          Column
        </Head.title>
        <Head.title @class="col-xs-1">
          Data Type
        </Head.title>
        <Head.title @class="dataset-detail-table__th-comments">
          Default Comments
        </Head.title>
      </Table.head>
      <Table.body as |Body|>
        {{#each @schemas as |schema|}}
          <Body.row as |Row|>
            <Row.cell>
              <div class="dataset-detail-table__field-name">
                {{schema.fieldName}}
                {{#if schema.nullable}}
                  <span class="schema-property-indicator schema-property-indicator--nullable">
                    N
                    <EmberTooltip @text="Is Nullable" />
                  </span>
                {{/if}}
                {{#if schema.indexed}}
                  <span class="schema-property-indicator schema-property-indicator--indexed">
                    I
                    <EmberTooltip @text="Is Indexed" />
                  </span>
                {{/if}}
                {{#if schema.partitioned}}
                  <span class="schema-property-indicator schema-property-indicator--partitioned">
                    P
                    <EmberTooltip @text="Is Partitioned" />
                  </span>
                {{/if}}
                {{#if schema.distributed}}
                  <span class="schema-property-indicator schema-property-indicator--distributed">
                    D
                    <EmberTooltip @text="Is Distributed" />
                  </span>
                {{/if}}
              </div>

            </Row.cell>
            <Row.cell>
              {{schema.dataType}}
            </Row.cell>
            <Row.cell @class="commentsArea">
              <div class="commentsArea dataset-detail-table__comments">
                <p>
                  {{schema.commentHtml}}
                </p>
              </div>
            </Row.cell>
          </Body.row>
        {{/each}}
      </Table.body>
    </NachoTable>
  {{else}}
    <EmberAce
      @class="dataset-compliance__editor"
      @minLines={{10}}
      @maxLines={{500}}
      @readOnly={{true}}
      @showLineNumbers={{true}}
      @useWrapMode={{true}}
      @showPrintMargin={{false}}
      @mode={{this.aceMode}}
      @worker={{concat this.aceMode "_worker"}}
      @value={{this.possibleJsonOutput}}
    />
  {{/if}}
{{else}}
    <EmptyState @heading={{"There was an error retrieving the Schema for this Dataset"}}/>
{{/if}}
